package osinfo

import (
	"log"

	"github.com/prometheus/procfs"
)

func (o *OSINFO) getMemTotalFromProcFS() *OSINFO {
	fs, err := procfs.NewFS(o.procPath)
	if err != nil {
		log.Printf("failed to open procfs: %s", err)
		return o
	}

	meminfo, err := fs.Meminfo()
	if err != nil {
		log.Printf("Failed to get memory info: %s", err)
	}

	o.MemoryTotalBytes = float64(*meminfo.MemTotalBytes)
	return o
}
